package name.fowler.refactoring.simplestore.reporter;

import java.util.List;

public class AllCustomersRentReportFormatter extends ReportFormatter {
	private String report;
	
	public AllCustomersRentReportFormatter() {
	}
	
	public String formatReport(List<String> reportStructure){
		StringBuffer buffer = new StringBuffer();
		if (!reportStructure.get(0).equalsIgnoreCase("AllCustomersRentAmountStructure")){ 
			report = null;
			return report;
		}
		
		for (int j=1;j<reportStructure.size()-2;j++){
			String[] info = reportStructure.get(j).split("\n");
			buffer.append(info[0]).append(" has rent amount = ").append(info[1]);
			buffer.append(" and bonus points = ").append(info[2]).append("\n");
		}
		buffer.append("All customers rent amount = ").append(reportStructure.get(reportStructure.size()-2));
		report = buffer.toString();
		return report;
	}

	
}
